package cn.com.Thread;

public class ThreadInfoDemo {

    public static void main(String[] args) {
        //获取主线程
        Thread main = Thread.currentThread();

        //获取主线程的名字
        String name = main.getName();
        System.out.println("主线程的名字: " + name);

        //获取该线程的唯一标识
        long id = main.getId();
        System.out.println("主线程的ID: " + id);
        //获取该线程的优先级
        int priority = main.getPriority();


        System.out.println("线程优先级: " + priority);
//该线程是否活着
        boolean isalive = main.isAlive();
        System.out.println("线程是否存活: " + isalive);
        //是否为守护线程
        boolean isDaemon = main.isDaemon();
        System.out.println("是否为守护线程: " + isDaemon);
        //是否被中断了
        boolean isInterrupted = main.isInterrupted();
        System.out.println("是否被中断了: " + isInterrupted);
    }
}
